package router

import (
	"chat/controllers"
	"chat/interrupt"
	"github.com/gin-gonic/gin"
)

func InitRouter() *gin.Engine {
	var r = gin.Default()
	r.POST("/login", controllers.Login)
	r.POST("/register", controllers.Register)
	//r.GET("/conn", util.WebSocketHandler)

	auth := r.Group("")
	auth.Use(interrupt.LoginVerify())
	{
		auth.GET("/conn", controllers.WebSocketHandler)
		auth.GET("/user/info", controllers.GetUserInfo)
	}

	return r
}
